<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <fieldset>
        <legend>测试session</legend>
        <button type="button" onclick="add()">一键添加</button>
        <button type="button" onclick="get()">一键获取</button>
        <button type="button" onclick="getglobal()">一键获取全局</button>
        <img src="http://localhost:3000/users/getCaptcha" onclick="javascript:this.setAttribute('src','http://localhost:3000/users/getCaptcha?v='+new Date().getTime())">
    </fieldset>
</body>
<script src="jquery-2.2.3.min.js"></script>
<script>
    $(function () {

    })
    function add() {
        $.ajax({
            url:'http://localhost:3000/users/add',
            type:'post',
            data:{
                name:'li'
            },
            success:function () {
                alert('测试成功')
            },
            error:function (error) {
                alert(error.responseText)
            }
        })
    }
    function get() {
        $.ajax({
            url:'http://localhost:3000/users/get?',
            type:'get',
            data:{
                name:'li'
            },
            success:function (result) {
                alert('接受到的东西'+result)
            },
            error:function () {
                alert(error.responseText)
            }
        })
    }
    function getglobal() {
        $.ajax({
            url:'http://localhost:3000/users/getglobal?',
            type:'get',
            data:{
                name:'li'
            },
            success:function (result) {
                alert('接受到的东西'+result)
            },
            error:function () {
                alert(error.responseText)
            }
        })
    }
</script>
</html>